* ----------------------------- *
* Figuretools DHOZ              *
* ----------------------------- *



*// use a serif font
graph set window fontface "Times New Roman" 
*Latin Modern Roman is original but not working obviously

*// use plotplain as default, customize with grstyle
set scheme plotplain
grstyle init

*// plot: lines
grstyle set linewidth medthin medthin medthin medthin medthin medthin medthin medthin: p#
grstyle set lpattern solid solid solid solid solid solid solid: p# // TODO: this doesn't work
grstyle set color gs4: p#

*// plot: symbols
grstyle set symbol o o o o o o o o o o o o: p# 
grstyle set symbolsize medium medium medium medium medium medium medium medium: p#
grstyle set symbolsize medthick: p#coefplot

*// legend
grstyle set legend 6, nobox

*// size and margin
grstyle set graphsize 11cm 14cm
grstyle set margin ".25 .25 .25 .25", cm: coefplot graph twoway

*// grid 
grstyle set nogrid
grstyle set horizontal
grstyle set color gs14: major_grid 
grstyle set color gs6: tick
grstyle set linewidth thin: major_grid tick
grstyle set lpattern dash: major_grid

*// axis
grstyle set size medsmall: axis_title
grstyle set color gs6: axisline
grstyle set linewidth thin: axisline
grstyle yesno extend_axes_full_low yes
grstyle yesno extend_axes_full_high yes

*// added lines and text
grstyle set color gs3: xyline
grstyle set lpattern dash: xyline
grstyle set linewidth thin: xyline
*// grstyle set size *0.9: text_option // TODO: doesn't work
grstyle set color gs3: text_option

*// colors - monochrome red
local crm1 "89 13 34"
local crm2 "128 15 47"
local crm3 "164 19 60"
local crm4 "201 24 74"
local crm5 "255 77 109"
local crm6 "255 117 143"
local crm7 "255 143 163"
local crm8 "255 179 193"
local crm9 "255 204 213"
local crm10 "255 240 243"
local crm11 "0 0 0"
local crm12 "102 102 102"
local crm13 "153 153 153"
local crm "`crm1' `crm2' `crm3' `crm4' `crm5' `crm6' `crm7' `crm8' `crm9' `crm10'"

*// colors - monochrome grey
local cgm1 "0 0 0"



*// specifics
if "`plot_type'" == "bar" { 
    grstyle set lpattern solid: xyline
    *// TODO: the below does not work in the hists
    grstyle set linewidth 0.25pt: p#bar p#box p#histogram
    colorpalette ptol, n(1) nograph
    grstyle set color "`r(p1)'": p#box p#bar
    grstyle set color white: p#boxline p#barline p#histogram_line
}